package cn.db101.kaoqinserver.controller;

import cn.db101.kaoqinserver.config.ApiResult;
import cn.db101.kaoqinserver.domain.Check;
import cn.db101.kaoqinserver.domain.User;
import cn.db101.kaoqinserver.model.FaceResult;
import cn.db101.kaoqinserver.model.request.FaceRequest;
import cn.db101.kaoqinserver.model.response.FileResponse;
import cn.db101.kaoqinserver.service.FaceService;
import cn.db101.kaoqinserver.service.UserService;
import cn.dev33.satoken.stp.StpUtil;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("v1/kaoqin/face")
public class FaceController {

    @Autowired
    private FaceService faceService;

    @PostMapping("verify")
    public ApiResult<FaceResult> uploadFile(@RequestBody Check check) throws IOException {

        int loginId = Integer.parseInt(StpUtil.getLoginId().toString());
        check.setUserId(loginId);
        return faceService.faceCompare(check);
    }

}
